<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="../lib/vue.js"></script>
</head>
<body>
    <div id="app">
        <input type="button" value="获取dom" @click="getElemnt">
        <h3 id="myh3" ref="myh3">哈哈哈哈，获取我吧</h3>
    </div>

    <script>
        var vm = new Vue({
            el:'#app',
            data:{

            },
            methods: {
                getElemnt(){
                    console.log(document.getElementById("myh3"));
                    // 使用$refs获取dom元素 也可以引用组件
                    console.log(this.$refs.myh3.innerText);
                }
            }
        })
    </script>
</body>
</html>